namespace EyeOpen.Trial.Windows
{
	using System.Windows.Forms;

	using EyeOpen.Trial.Windows.Properties;

	internal class FormSelector
	{
		public Form Select()
		{
			var serial = Settings.Default.Serial;

			if (string.IsNullOrWhiteSpace(serial))
			{
				return
					new RegisterForm(false);
			}
			
			using (
				var proxy = new ProxyBuilder().Get())
			{
				if (!proxy.IsValid(serial))
				{
					return 
						new RegisterForm(true);
				}
				
				return
					new MainForm();
			}
		}
	}
}